package com.usiful.util;

import java.util.List;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.usiful.model.FollowSale;
import com.usiful.model.Product;

/**
 * 
 * @author [周织能]
 * @description  gson工具类
 * @date 2016年7月30日
 * @email 742408364@qq.com
 */
public class UsifulGsonHelper {
	
	@SuppressWarnings("unchecked")
	public static Object json2Object(String json,@SuppressWarnings("rawtypes") Class clazz) {
		return new Gson().fromJson(json, clazz);
	}
	
	public static String object2Json(Object obj) {
		return new Gson().toJson(obj);
	}
	
	public static List<Product> json2ProductList(String json) {
		return new Gson().fromJson(json, new TypeToken<List<Product>>(){}.getType());  
	}
	
	public static List<FollowSale> json2FollowSaleList(String json) {
		return new Gson().fromJson(json, new TypeToken<List<FollowSale>>(){}.getType());  
	}
	
	public static void searilize(List<Product> products) {
		
	}
}
